/*
 * =====================================================================================
 *
 *       Filename:  dlist.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  06/12/2011 02:40:51 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (), 
 *        Company:  
 *
 * =====================================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>

#ifndef DLIST_H
#define DLIST_H

#ifdef __cplusplus
extern "C" {
#endif/*__cplusplus*/

typedef enum _DListRet
{
    DLIST_RET_OK = 0,
    DLIST_RET_OOM,
    DLIST_RET_STOP,
    DLIST_RET_PARAMS,
    DLIST_RET_FAIL
}DListRet;

struct _DList;
typedef struct _DList DList;

typedef DListRet (*DListDataPrintFunc)(void* data);

DListRet dlist_create(DList *pDList);

DListRet dlist_insert(DList *thiz, size_t index, void *data);
DListRet dlist_get_by_index(DList *thiz, size_t index, void **data);
DListRet dlist_set_by_index(DList *thiz, size_t index, void *data);
size_t dilist_length(DList *thiz);
DListRet dlist_print(DList *thiz, DListDataPrintFunc print);

void dlist_destroy(DList *thiz);

#ifdef __cplusplus
}
#endif /*__cplusplus*/

#endif /*DLIST*/
